package com.ssy.lingxi.order.model.vo.mobile.response;

import com.ssy.lingxi.order.utils.NumberUtil;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 订单收发货 - 商品信息
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-19
 */
public class MobileOrderDeliverProductDetailVO implements Serializable {
    private static final long serialVersionUID = 2553399203735300353L;

    public MobileOrderDeliverProductDetailVO(Long deliveryProductId, String logo, String name, String category, String brand, String unit, String spec, BigDecimal delivered, BigDecimal received) {
        this.deliveryProductId = deliveryProductId;
        this.logo = StringUtils.hasLength(logo) ? logo : "";
        this.name = name;
        this.category = category;
        this.brand = brand;
        this.unit = unit;
        this.spec = spec;
        this.delivered = NumberUtil.formatToInteger(delivered);
        this.received = NumberUtil.formatToInteger(received);
    }

    /**
     * 发货商品记录Id（后台用于去重，前端无用）
     */
    private Long deliveryProductId;

    /**
     * 商品logo
     */
    private String logo;

    /**
     * 商品名称
     */
    private String name;

    /**
     * 商品品类
     */
    private String category;

    /**
     * 商品品牌
     */
    private String brand;

    /**
     * 计价单位
     */
    private String unit;

    /**
     * 商品规格
     */
    private String spec;

    /**
     * 已发货数量
     */
    private String delivered;

    /**
     * 已收货的数量， 如还没收货则为0
     */
    private String received;

    public Long getDeliveryProductId() {
        return deliveryProductId;
    }

    public void setDeliveryProductId(Long deliveryProductId) {
        this.deliveryProductId = deliveryProductId;
    }

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public String getDelivered() {
        return delivered;
    }

    public void setDelivered(String delivered) {
        this.delivered = delivered;
    }

    public String getReceived() {
        return received;
    }

    public void setReceived(String received) {
        this.received = received;
    }

//    @Override
//    public boolean equals(Object o) {
//        if (this == o) {
//            return true;
//        }
//
//        if (o == null || getClass() != o.getClass()) {
//            return false;
//        }
//
//        MobileOrderDeliverProductDetailVO that = (MobileOrderDeliverProductDetailVO) o;
//        return Objects.equals(deliveryProductId, that.deliveryProductId);
//    }
//
//    @Override
//    public int hashCode() {
//        return Objects.hash(deliveryProductId);
//    }
}
